package net.sudot.chess.business.service;

import net.sudot.chess.business.dao.RoomCustomerRefDao;
import net.sudot.chess.business.model.RoomCustomerRef;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 房间和玩家关联
 *
 * @author tangjialin on 2018-03-03.
 */
@Service
public class RoomCustomerRefService extends BaseService<RoomCustomerRef> {

    @Resource
    private RoomCustomerRefDao roomCustomerRefDao;

    /**
     * 获取房间玩家关联信息
     *
     * @param roomId 房间主键
     * @return 返回房间玩家关联信息
     */
    public List<RoomCustomerRef> findByRoom(Long roomId) {
        return roomCustomerRefDao.findList("roomId", roomId);
    }

    /**
     * 获取房间玩家关联信息
     *
     * @param roomId     房间主键
     * @param customerId 客户主键
     * @return 返回房间玩家关联信息
     */
    public RoomCustomerRef findByRoomAndCustomer(Long roomId, Long customerId) {
        return roomCustomerRefDao.findByRoomAndCustomer(roomId, customerId);
    }
}
